package com.ayoka.parenting.utils;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.ayoka.parenting.R;


/**
 * Created by jinchunping on 2019/1/28.
 */

public class EmptyDataUtil {

    public static View getEmptyView(Context context, int iconResId, String title, View.OnClickListener onClickListener) {
        LayoutInflater inflater = LayoutInflater.from(context);
        View notDataView = inflater.inflate(R.layout.layout_empty_view, null);
        ImageView iv_icon = (ImageView) notDataView.findViewById(R.id.iv_icon);
        iv_icon.setImageResource(iconResId);
        TextView tv_title = (TextView) notDataView.findViewById(R.id.tv_title);
        tv_title.setText(title);
        if (onClickListener != null) {
            notDataView.setOnClickListener(onClickListener);
        }
        return notDataView;
    }
}
